﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace Dycox.Linq
{
    public class BuildPropertyEventArgs<T> : EventArgs
    {
        public BuildPropertyEventArgs(QueryProperty property, PropertyInfo targetProeprty, IQueryable<T> query, object value)
        {
            if (property == null)
                throw new ArgumentNullException("property");

            _argumentProperty = property;
            _targetProperty = targetProeprty;
            _argumentValue = value;
            Query = query;
        }

        private object _argumentValue;

        public object ArgumentValue
        {
            get { return _argumentValue; }
        }


        private IQueryable<T> _query;

        public IQueryable<T> Query
        {
            get { return _query; }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("Query");

                _query = value;
            }
        }

        private QueryProperty _argumentProperty;

        public QueryProperty ArgumentProperty
        {
            get { return _argumentProperty; }
        }

        private PropertyInfo _targetProperty;

        public PropertyInfo TargetProperty
        {
            get { return _targetProperty; }
        }

    }

    public delegate void BuildPropertyEventHandler<T>(object sender, BuildPropertyEventArgs<T> e);
}
